70

Beginner’s Guide to Code Algorithms

70

capability of operating both on a computer and a smartphone. The added benefit of

this program is that in addition to moving the slides, the speaker can present content

“on the fly”, directly from the smartphone. For example, the speaker can now add

impromptu short messages or thank you notes as required over the existing slides!

The remote control is now in the hands of the speaker!

This chapter describes the workings of this simple program.

The system has two basic parts:

• A powerpoint slide pack that needs to be moved from slide to slide on your

laptop/​desktop.

• A remote control device which is a small file on googledocs manipulated

through the googledocs app on your smartphone.

4.1  CONNECTING THE SMARTPHONE TO THE

LAPTOP – VIRTUALLY

Both laptop and smartphone need to be connected to the internet for the magic to work.

The program enables the powerpoint slides on the laptop/​desktop to read the

googledocs file maintained from the smartphone and moves the slides based on its

contents. In order to make it meaningful, we need to come up with a set of codes that

can be interpreted by the program to do useful actions.

Once the connection between these two components is established, you can set

up any code you like—​there is no limit to creativity! But this is a set that does some

basic jobs and a bit more.

B

Blank out this slide

N

Go to Next Slide

P

Go to Previous Slide

#

Start or end of text to display

X

Exit from the program

Googledocs puts you document in the cloud and allows you to access it using a

URL. This is the property that we can exploit to write this novel program. The fol­

lowing link points to the file that has been created to drive the program.

https://​docs.google.com/​document/​d/​1-​6ZjkbA9nM1gCCIkot0dimp5Wmu5ZIPg

B1DjoPB5eDo/​edit?usp=​sharing

This document has its sharing parameter set so that anyone can update it. You

can, of course set your own parameters with your own document. A document is just

a blank file with a marker-​text (explained in the next paragraph). Just remember to

change the link in the program.

It is important for the program to know where to read from in the file. For this

reason, we have created a marker-​text—​“SlideMover”. When the program reads this

text, it knows to start reading from the very next character.

The code for the powerpoint sits in a macro. But then you would not know which

slide deck you need to work with in advance. So the macro is in its own powerpoint

deck with only one slide in it. This slide has a picture that kicks off the macro by

clicking on it. See example below on how to set up this slide. To start off we need a

picture—​in this example this is a man playing the trumpet.